package com.mycompany.mvc.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SystemListener implements ServletContextListener{

	private Logger logger = LoggerFactory.getLogger(SystemListener.class);
	
	/**
	 * 获取系统绝对路径
	 */
	@Override
	public void contextInitialized(ServletContextEvent servletContext) {
		logger.debug("servletContext init start...");
		System.setProperty("realPath", servletContext.getServletContext().getRealPath("/"));
		logger.debug("servletContext init end...");
	}
	
	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		
	}
}
